package org.jivesoftware.smackx.packet;

import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;

public class DefaultPrivateData
  implements PrivateData
{
  private String elementName;
  private String namespace;
  private Map<String, String> map;

  public DefaultPrivateData(String paramString1, String paramString2)
  {
    this.elementName = paramString1;
    this.namespace = paramString2;
  }

  public String getElementName()
  {
    return this.elementName;
  }

  public String getNamespace()
  {
    return this.namespace;
  }

  public String toXML()
  {
    StringBuilder localStringBuilder = new StringBuilder();
    localStringBuilder.append("<").append(this.elementName).append(" xmlns=\"").append(this.namespace).append("\">");
    Iterator localIterator = getNames();
    while (localIterator.hasNext())
    {
      String str1 = (String)localIterator.next();
      String str2 = getValue(str1);
      localStringBuilder.append("<").append(str1).append(">");
      localStringBuilder.append(str2);
      localStringBuilder.append("</").append(str1).append(">");
    }
    localStringBuilder.append("</").append(this.elementName).append(">");
    return localStringBuilder.toString();
  }

  public synchronized Iterator<String> getNames()
  {
    if (this.map == null)
      return Collections.emptyList().iterator();
    return Collections.unmodifiableSet(this.map.keySet()).iterator();
  }

  public synchronized String getValue(String paramString)
  {
    if (this.map == null)
      return null;
    return (String)this.map.get(paramString);
  }

  public synchronized void setValue(String paramString1, String paramString2)
  {
    if (this.map == null)
      this.map = new HashMap();
    this.map.put(paramString1, paramString2);
  }
}

/* Location:           D:\hygieia\userclient\common\libs\easemobchat_2.1.8.jar
 * Qualified Name:     org.jivesoftware.smackx.packet.DefaultPrivateData
 * JD-Core Version:    0.6.1
 */